﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using DevExpress.XtraCharts;
using ERP_RORZE_SYSTEM;
using System.Data;
using System.Windows.Forms;

namespace ERP_RORZE_DLL.Assembly
{
    public partial class rpt_F5TimeMonthly : DevExpress.XtraReports.UI.XtraReport
    {
        public string year;
        public string plan;

        private DataTable ControllerTable;
        private DataTable ControllerTableShow;
        private DataTable ControllerChartTable;

        private DataTable FINTable;
        private DataTable FINTableShow;
        private DataTable FINChartTable;

        private DataTable MouterTable;
        private DataTable MouterTableShow;
        private DataTable MouterChartTable;

        private DataTable AssTable;
        private DataTable AssTableShow;
        private DataTable AssChartTable;

        public rpt_F5TimeMonthly()
        {
            InitializeComponent();
            this.year = null;
            this.plan = null;            

            this.ControllerTable = new DataTable();
            this.ControllerTableShow = new DataTable();
            this.ControllerChartTable = new DataTable();

            this.FINTable = new DataTable();
            this.FINTableShow = new DataTable();
            this.FINChartTable = new DataTable();

            this.MouterTable = new DataTable();
            this.MouterTableShow = new DataTable();
            this.MouterChartTable = new DataTable();

            this.AssTable = new DataTable();
            this.AssTableShow = new DataTable();
            this.AssChartTable = new DataTable();
        }

        private void BindData()
        {
            /// CONTROLLER
            this.ControllerReport.DataSource = this.ControllerTableShow;

            controllerJanLabel.Text = "Jan-" + this.year.Substring(2, 2);
            controllerFebLabel.Text = "Feb-" + this.year.Substring(2, 2);
            controllerMarLabel.Text = "Mar-" + this.year.Substring(2, 2);
            controllerAprLabel.Text = "Apr-" + this.year.Substring(2, 2);
            controllerMayLabel.Text = "May-" + this.year.Substring(2, 2);
            controllerJunLabel.Text = "Jun-" + this.year.Substring(2, 2);
            controllerJulLabel.Text = "Jul-" + this.year.Substring(2, 2);
            controllerAugLabel.Text = "Aug-" + this.year.Substring(2, 2);
            controllerSepLabel.Text = "Sep-" + this.year.Substring(2, 2);
            controllerOctLabel.Text = "Oct-" + this.year.Substring(2, 2);
            controllerNovLabel.Text = "Nov-" + this.year.Substring(2, 2);
            controllerDecLabel.Text = "Dec-" + this.year.Substring(2, 2);

            itemName.DataBindings.Add("Text", this.ControllerReport.DataSource, "Items");
            controllerJan.DataBindings.Add("Text", this.ControllerReport.DataSource, "Jan-" + this.year.Substring(2, 2));
            controllerFeb.DataBindings.Add("Text", this.ControllerReport.DataSource, "Feb-" + this.year.Substring(2, 2));
            controllerMar.DataBindings.Add("Text", this.ControllerReport.DataSource, "Mar-" + this.year.Substring(2, 2));
            controllerApr.DataBindings.Add("Text", this.ControllerReport.DataSource, "Apr-" + this.year.Substring(2, 2));
            controllerMay.DataBindings.Add("Text", this.ControllerReport.DataSource, "May-" + this.year.Substring(2, 2));
            controllerJun.DataBindings.Add("Text", this.ControllerReport.DataSource, "Jun-" + this.year.Substring(2, 2));
            controllerJul.DataBindings.Add("Text", this.ControllerReport.DataSource, "Jul-" + this.year.Substring(2, 2));
            controllerAug.DataBindings.Add("Text", this.ControllerReport.DataSource, "Aug-" + this.year.Substring(2, 2));
            controllerSep.DataBindings.Add("Text", this.ControllerReport.DataSource, "Sep-" + this.year.Substring(2, 2));
            controllerOct.DataBindings.Add("Text", this.ControllerReport.DataSource, "Oct-" + this.year.Substring(2, 2));
            controllerNov.DataBindings.Add("Text", this.ControllerReport.DataSource, "Nov-" + this.year.Substring(2, 2));
            controllerDec.DataBindings.Add("Text", this.ControllerReport.DataSource, "Dec-" + this.year.Substring(2, 2));
            controllerTotal.DataBindings.Add("Text", this.ControllerReport.DataSource, this.year);

            this.controllerChart.Titles[0].Text = "Time chart " + this.year + " CONTROLLER";

            this.controllerChart.Series["Plan"].DataSource = this.ControllerChartTable;
            this.controllerChart.Series["Plan"].ArgumentScaleType = ScaleType.Auto;
            this.controllerChart.Series["Plan"].ArgumentDataMember = "Month";
            this.controllerChart.Series["Plan"].ValueScaleType = ScaleType.Numerical;
            this.controllerChart.Series["Plan"].ValueDataMembers.AddRange(new string[] { "Plan" });

            this.controllerChart.Series["Actual"].DataSource = this.ControllerChartTable;
            this.controllerChart.Series["Actual"].ArgumentScaleType = ScaleType.Auto;
            this.controllerChart.Series["Actual"].ArgumentDataMember = "Month";
            this.controllerChart.Series["Actual"].ValueScaleType = ScaleType.Numerical;
            this.controllerChart.Series["Actual"].ValueDataMembers.AddRange(new string[] { "Actual" });

            this.controllerChart.Series["Standard Time (TGC)"].DataSource = this.ControllerChartTable;
            this.controllerChart.Series["Standard Time (TGC)"].ArgumentScaleType = ScaleType.Auto;
            this.controllerChart.Series["Standard Time (TGC)"].ArgumentDataMember = "Month";
            this.controllerChart.Series["Standard Time (TGC)"].ValueScaleType = ScaleType.Numerical;
            this.controllerChart.Series["Standard Time (TGC)"].ValueDataMembers.AddRange(new string[] { "StdTime" });

            this.controllerChart.Series["Actual Time (TGTT)"].DataSource = this.ControllerChartTable;
            this.controllerChart.Series["Actual Time (TGTT)"].ArgumentScaleType = ScaleType.Auto;
            this.controllerChart.Series["Actual Time (TGTT)"].ArgumentDataMember = "Month";
            this.controllerChart.Series["Actual Time (TGTT)"].ValueScaleType = ScaleType.Numerical;
            this.controllerChart.Series["Actual Time (TGTT)"].ValueDataMembers.AddRange(new string[] { "ActTime" });

            this.controllerChart.Series["Different Time"].DataSource = this.ControllerChartTable;
            this.controllerChart.Series["Different Time"].ArgumentScaleType = ScaleType.Auto;
            this.controllerChart.Series["Different Time"].ArgumentDataMember = "Month";
            this.controllerChart.Series["Different Time"].ValueScaleType = ScaleType.Numerical;
            this.controllerChart.Series["Different Time"].ValueDataMembers.AddRange(new string[] { "DiffTime" });

            /// FIN
            this.FINReport.DataSource = this.FINTableShow;

            FINJanLabel.Text = "Jan-" + this.year.Substring(2, 2);
            FINFebLabel.Text = "Feb-" + this.year.Substring(2, 2);
            FINMarLabel.Text = "Mar-" + this.year.Substring(2, 2);
            FINAprLabel.Text = "Apr-" + this.year.Substring(2, 2);
            FINMayLabel.Text = "May-" + this.year.Substring(2, 2);
            FINJunLabel.Text = "Jun-" + this.year.Substring(2, 2);
            FINJulLabel.Text = "Jul-" + this.year.Substring(2, 2);
            FINAugLabel.Text = "Aug-" + this.year.Substring(2, 2);
            FINSepLabel.Text = "Sep-" + this.year.Substring(2, 2);
            FINOctLabel.Text = "Oct-" + this.year.Substring(2, 2);
            FINNovLabel.Text = "Nov-" + this.year.Substring(2, 2);
            FINDecLabel.Text = "Dec-" + this.year.Substring(2, 2);

            FINitems.DataBindings.Add("Text", this.FINReport.DataSource, "Items");
            FINJan.DataBindings.Add("Text", this.FINReport.DataSource, "Jan-" + this.year.Substring(2, 2));
            FINFeb.DataBindings.Add("Text", this.FINReport.DataSource, "Feb-" + this.year.Substring(2, 2));
            FINMar.DataBindings.Add("Text", this.FINReport.DataSource, "Mar-" + this.year.Substring(2, 2));
            FINApr.DataBindings.Add("Text", this.FINReport.DataSource, "Apr-" + this.year.Substring(2, 2));
            FINMay.DataBindings.Add("Text", this.FINReport.DataSource, "May-" + this.year.Substring(2, 2));
            FINJun.DataBindings.Add("Text", this.FINReport.DataSource, "Jun-" + this.year.Substring(2, 2));
            FINJul.DataBindings.Add("Text", this.FINReport.DataSource, "Jul-" + this.year.Substring(2, 2));
            FINAug.DataBindings.Add("Text", this.FINReport.DataSource, "Aug-" + this.year.Substring(2, 2));
            FINSep.DataBindings.Add("Text", this.FINReport.DataSource, "Sep-" + this.year.Substring(2, 2));
            FINOct.DataBindings.Add("Text", this.FINReport.DataSource, "Oct-" + this.year.Substring(2, 2));
            FINNov.DataBindings.Add("Text", this.FINReport.DataSource, "Nov-" + this.year.Substring(2, 2));
            FINDec.DataBindings.Add("Text", this.FINReport.DataSource, "Dec-" + this.year.Substring(2, 2));
            FINTotal.DataBindings.Add("Text", this.FINReport.DataSource, this.year);

            this.FINChart.Titles[0].Text = "Time chart " + this.year + " FIN";

            this.FINChart.Series["Plan"].DataSource = this.FINChartTable;
            this.FINChart.Series["Plan"].ArgumentScaleType = ScaleType.Auto;
            this.FINChart.Series["Plan"].ArgumentDataMember = "Month";
            this.FINChart.Series["Plan"].ValueScaleType = ScaleType.Numerical;
            this.FINChart.Series["Plan"].ValueDataMembers.AddRange(new string[] { "Plan" });

            this.FINChart.Series["Actual"].DataSource = this.FINChartTable;
            this.FINChart.Series["Actual"].ArgumentScaleType = ScaleType.Auto;
            this.FINChart.Series["Actual"].ArgumentDataMember = "Month";
            this.FINChart.Series["Actual"].ValueScaleType = ScaleType.Numerical;
            this.FINChart.Series["Actual"].ValueDataMembers.AddRange(new string[] { "Actual" });

            this.FINChart.Series["Standard Time (TGC)"].DataSource = this.FINChartTable;
            this.FINChart.Series["Standard Time (TGC)"].ArgumentScaleType = ScaleType.Auto;
            this.FINChart.Series["Standard Time (TGC)"].ArgumentDataMember = "Month";
            this.FINChart.Series["Standard Time (TGC)"].ValueScaleType = ScaleType.Numerical;
            this.FINChart.Series["Standard Time (TGC)"].ValueDataMembers.AddRange(new string[] { "StdTime" });

            this.FINChart.Series["Actual Time (TGTT)"].DataSource = this.FINChartTable;
            this.FINChart.Series["Actual Time (TGTT)"].ArgumentScaleType = ScaleType.Auto;
            this.FINChart.Series["Actual Time (TGTT)"].ArgumentDataMember = "Month";
            this.FINChart.Series["Actual Time (TGTT)"].ValueScaleType = ScaleType.Numerical;
            this.FINChart.Series["Actual Time (TGTT)"].ValueDataMembers.AddRange(new string[] { "ActTime" });

            this.FINChart.Series["Different Time"].DataSource = this.FINChartTable;
            this.FINChart.Series["Different Time"].ArgumentScaleType = ScaleType.Auto;
            this.FINChart.Series["Different Time"].ArgumentDataMember = "Month";
            this.FINChart.Series["Different Time"].ValueScaleType = ScaleType.Numerical;
            this.FINChart.Series["Different Time"].ValueDataMembers.AddRange(new string[] { "DiffTime" });

            /// Mouter
            this.MouterReport.DataSource = this.MouterTableShow;

            mouterJanLabel.Text = "Jan-" + this.year.Substring(2, 2);
            mouterFebLabel.Text = "Feb-" + this.year.Substring(2, 2);
            mouterMarLabel.Text = "Mar-" + this.year.Substring(2, 2);
            mouterAprLabel.Text = "Apr-" + this.year.Substring(2, 2);
            mouterMayLabel.Text = "May-" + this.year.Substring(2, 2);
            mouterJunLabel.Text = "Jun-" + this.year.Substring(2, 2);
            mouterJulLabel.Text = "Jul-" + this.year.Substring(2, 2);
            mouterAugLabel.Text = "Aug-" + this.year.Substring(2, 2);
            mouterSepLabel.Text = "Sep-" + this.year.Substring(2, 2);
            mouterOctLabel.Text = "Oct-" + this.year.Substring(2, 2);
            mouterNovLabel.Text = "Nov-" + this.year.Substring(2, 2);
            mouterDecLabel.Text = "Dec-" + this.year.Substring(2, 2);

            mouterItems.DataBindings.Add("Text", this.MouterReport.DataSource, "Items");
            mouterJan.DataBindings.Add("Text", this.MouterReport.DataSource, "Jan-" + this.year.Substring(2, 2));
            mouterFeb.DataBindings.Add("Text", this.MouterReport.DataSource, "Feb-" + this.year.Substring(2, 2));
            mouterMar.DataBindings.Add("Text", this.MouterReport.DataSource, "Mar-" + this.year.Substring(2, 2));
            mouterApr.DataBindings.Add("Text", this.MouterReport.DataSource, "Apr-" + this.year.Substring(2, 2));
            mouterMay.DataBindings.Add("Text", this.MouterReport.DataSource, "May-" + this.year.Substring(2, 2));
            mouterJun.DataBindings.Add("Text", this.MouterReport.DataSource, "Jun-" + this.year.Substring(2, 2));
            mouterJul.DataBindings.Add("Text", this.MouterReport.DataSource, "Jul-" + this.year.Substring(2, 2));
            mouterAug.DataBindings.Add("Text", this.MouterReport.DataSource, "Aug-" + this.year.Substring(2, 2));
            mouterSep.DataBindings.Add("Text", this.MouterReport.DataSource, "Sep-" + this.year.Substring(2, 2));
            mouterOct.DataBindings.Add("Text", this.MouterReport.DataSource, "Oct-" + this.year.Substring(2, 2));
            mouterNov.DataBindings.Add("Text", this.MouterReport.DataSource, "Nov-" + this.year.Substring(2, 2));
            mouterDec.DataBindings.Add("Text", this.MouterReport.DataSource, "Dec-" + this.year.Substring(2, 2));
            mouterTotal.DataBindings.Add("Text", this.MouterReport.DataSource, this.year);

            this.MouterChart.Titles[0].Text = "Time chart " + this.year + " MOUTER";

            this.MouterChart.Series["Plan"].DataSource = this.MouterChartTable;
            this.MouterChart.Series["Plan"].ArgumentScaleType = ScaleType.Auto;
            this.MouterChart.Series["Plan"].ArgumentDataMember = "Month";
            this.MouterChart.Series["Plan"].ValueScaleType = ScaleType.Numerical;
            this.MouterChart.Series["Plan"].ValueDataMembers.AddRange(new string[] { "Plan" });

            this.MouterChart.Series["Actual"].DataSource = this.MouterChartTable;
            this.MouterChart.Series["Actual"].ArgumentScaleType = ScaleType.Auto;
            this.MouterChart.Series["Actual"].ArgumentDataMember = "Month";
            this.MouterChart.Series["Actual"].ValueScaleType = ScaleType.Numerical;
            this.MouterChart.Series["Actual"].ValueDataMembers.AddRange(new string[] { "Actual" });

            this.MouterChart.Series["Standard Time (TGC)"].DataSource = this.MouterChartTable;
            this.MouterChart.Series["Standard Time (TGC)"].ArgumentScaleType = ScaleType.Auto;
            this.MouterChart.Series["Standard Time (TGC)"].ArgumentDataMember = "Month";
            this.MouterChart.Series["Standard Time (TGC)"].ValueScaleType = ScaleType.Numerical;
            this.MouterChart.Series["Standard Time (TGC)"].ValueDataMembers.AddRange(new string[] { "StdTime" });

            this.MouterChart.Series["Actual Time (TGTT)"].DataSource = this.MouterChartTable;
            this.MouterChart.Series["Actual Time (TGTT)"].ArgumentScaleType = ScaleType.Auto;
            this.MouterChart.Series["Actual Time (TGTT)"].ArgumentDataMember = "Month";
            this.MouterChart.Series["Actual Time (TGTT)"].ValueScaleType = ScaleType.Numerical;
            this.MouterChart.Series["Actual Time (TGTT)"].ValueDataMembers.AddRange(new string[] { "ActTime" });

            this.MouterChart.Series["Different Time"].DataSource = this.MouterChartTable;
            this.MouterChart.Series["Different Time"].ArgumentScaleType = ScaleType.Auto;
            this.MouterChart.Series["Different Time"].ArgumentDataMember = "Month";
            this.MouterChart.Series["Different Time"].ValueScaleType = ScaleType.Numerical;
            this.MouterChart.Series["Different Time"].ValueDataMembers.AddRange(new string[] { "DiffTime" });

            /// Ass
            this.AssReport.DataSource = this.AssTableShow;

            assJanLabel.Text = "Jan-" + this.year.Substring(2, 2);
            assFebLabel.Text = "Feb-" + this.year.Substring(2, 2);
            assMarLabel.Text = "Mar-" + this.year.Substring(2, 2);
            assAprLabel.Text = "Apr-" + this.year.Substring(2, 2);
            assMayLabel.Text = "May-" + this.year.Substring(2, 2);
            assJunLabel.Text = "Jun-" + this.year.Substring(2, 2);
            assJulLabel.Text = "Jul-" + this.year.Substring(2, 2);
            assAugLabel.Text = "Aug-" + this.year.Substring(2, 2);
            assSepLabel.Text = "Sep-" + this.year.Substring(2, 2);
            assOctLabel.Text = "Oct-" + this.year.Substring(2, 2);
            assNovLabel.Text = "Nov-" + this.year.Substring(2, 2);
            assDecLabel.Text = "Dec-" + this.year.Substring(2, 2);

            assItems.DataBindings.Add("Text", this.AssReport.DataSource, "Items");
            assJan.DataBindings.Add("Text", this.AssReport.DataSource, "Jan-" + this.year.Substring(2, 2));
            assFeb.DataBindings.Add("Text", this.AssReport.DataSource, "Feb-" + this.year.Substring(2, 2));
            assMar.DataBindings.Add("Text", this.AssReport.DataSource, "Mar-" + this.year.Substring(2, 2));
            assApr.DataBindings.Add("Text", this.AssReport.DataSource, "Apr-" + this.year.Substring(2, 2));
            assMay.DataBindings.Add("Text", this.AssReport.DataSource, "May-" + this.year.Substring(2, 2));
            assJun.DataBindings.Add("Text", this.AssReport.DataSource, "Jun-" + this.year.Substring(2, 2));
            assJul.DataBindings.Add("Text", this.AssReport.DataSource, "Jul-" + this.year.Substring(2, 2));
            assAug.DataBindings.Add("Text", this.AssReport.DataSource, "Aug-" + this.year.Substring(2, 2));
            assSep.DataBindings.Add("Text", this.AssReport.DataSource, "Sep-" + this.year.Substring(2, 2));
            assOct.DataBindings.Add("Text", this.AssReport.DataSource, "Oct-" + this.year.Substring(2, 2));
            assNov.DataBindings.Add("Text", this.AssReport.DataSource, "Nov-" + this.year.Substring(2, 2));
            assDec.DataBindings.Add("Text", this.AssReport.DataSource, "Dec-" + this.year.Substring(2, 2));
            assTotal.DataBindings.Add("Text", this.AssReport.DataSource, this.year);

            this.AssChart.Titles[0].Text = "Time chart " + this.year + " ASS";

            this.AssChart.Series["Plan"].DataSource = this.AssChartTable;
            this.AssChart.Series["Plan"].ArgumentScaleType = ScaleType.Auto;
            this.AssChart.Series["Plan"].ArgumentDataMember = "Month";
            this.AssChart.Series["Plan"].ValueScaleType = ScaleType.Numerical;
            this.AssChart.Series["Plan"].ValueDataMembers.AddRange(new string[] { "Plan" });

            this.AssChart.Series["Actual"].DataSource = this.AssChartTable;
            this.AssChart.Series["Actual"].ArgumentScaleType = ScaleType.Auto;
            this.AssChart.Series["Actual"].ArgumentDataMember = "Month";
            this.AssChart.Series["Actual"].ValueScaleType = ScaleType.Numerical;
            this.AssChart.Series["Actual"].ValueDataMembers.AddRange(new string[] { "Actual" });

            this.AssChart.Series["Standard Time (TGC)"].DataSource = this.AssChartTable;
            this.AssChart.Series["Standard Time (TGC)"].ArgumentScaleType = ScaleType.Auto;
            this.AssChart.Series["Standard Time (TGC)"].ArgumentDataMember = "Month";
            this.AssChart.Series["Standard Time (TGC)"].ValueScaleType = ScaleType.Numerical;
            this.AssChart.Series["Standard Time (TGC)"].ValueDataMembers.AddRange(new string[] { "StdTime" });

            this.AssChart.Series["Actual Time (TGTT)"].DataSource = this.AssChartTable;
            this.AssChart.Series["Actual Time (TGTT)"].ArgumentScaleType = ScaleType.Auto;
            this.AssChart.Series["Actual Time (TGTT)"].ArgumentDataMember = "Month";
            this.AssChart.Series["Actual Time (TGTT)"].ValueScaleType = ScaleType.Numerical;
            this.AssChart.Series["Actual Time (TGTT)"].ValueDataMembers.AddRange(new string[] { "ActTime" });

            this.AssChart.Series["Different Time"].DataSource = this.AssChartTable;
            this.AssChart.Series["Different Time"].ArgumentScaleType = ScaleType.Auto;
            this.AssChart.Series["Different Time"].ArgumentDataMember = "Month";
            this.AssChart.Series["Different Time"].ValueScaleType = ScaleType.Numerical;
            this.AssChart.Series["Different Time"].ValueDataMembers.AddRange(new string[] { "DiffTime" });
        }

        public void LoadData()
        {
            DataSet controllerDataSet = new DataSet();
            DataSet FINDataSet = new DataSet();
            DataSet MouterDataSet = new DataSet();
            DataSet AssDataSet = new DataSet();

            INISettings mySettings = new INISettings();
            SQLManagement mySQLManagement = new SQLManagement();
            mySQLManagement.SQLConnectionString = mySettings.SQLConnectionString;
            
            // Get data for Controller Report
            string sql_controller = "SELECT 'Plan' AS [Items],"
                + " " + this.plan + " AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [May-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [" + this.year + "]"
                + " UNION ALL"
                + " SELECT 'Actual' AS [Items],"
                + " 0 AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [May-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [" + this.year + "]"
                + " UNION ALL"
                + " SELECT 'Standard Time (TGC)' AS [Items],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 1 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 2 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 3 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 4 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 5 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [May-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 6 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 7 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 8 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 9 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 10 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 11 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 12 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(t1.[AssSTDTime] * t2.CommandQuantity)/60), 0, 0) AS [" + this.year + "]"
                + " FROM [222_Part] AS t1 INNER JOIN"
                + " [231_F5Plan] AS t2 ON t1.PartNo = t2.PartNo"
                + " WHERE (DATEPART(year, t2.FinishedDate) = " + this.year + ") AND (t1.F5 = 1)"
                + " UNION ALL"
                + " SELECT 'Actual Time (TGTT)' AS [Items],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 1 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 2 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 3 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 4 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 5 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [May-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 6 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 7 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 8 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 9 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 10 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 11 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 12 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " SUM(t1.[AssemblyTime])/60 AS [" + this.year + "]"
                + " FROM [231_TimeInput] AS t1 INNER JOIN"
                + " [231_F5Plan] AS t2 ON t1.TimePlanNo = t2.OrderNo INNER JOIN"
                + " [222_Part] AS t3 ON t2.PartNo = t3.PartNo"
                + " WHERE (DATEPART(year, t2.FinishedDate) = " + this.year + ") AND (t1.F5 = 1) AND (t3.F5 = 1)"
                + " UNION ALL"
                + " SELECT 'Different time' AS [Items],"
                + " 0 AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [May-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [" + this.year + "]";

            controllerDataSet = mySQLManagement.SQL_Query(sql_controller);
            if (controllerDataSet != null)
            {
                ControllerTable = controllerDataSet.Tables[0];

                for (int i = 1; i < this.ControllerTable.Columns.Count; i++)
                {
                    double std = Double.Parse(this.ControllerTable.Rows[2][i].ToString());
                    double act = Double.Parse(this.ControllerTable.Rows[3][i].ToString());

                    this.ControllerTable.Rows[4][i] = std - act;

                    if (std != 0)
                    {
                        this.ControllerTable.Rows[1][i] = Math.Round(((std - act) / std) * 100, 2);
                    }
                }

                this.ControllerTableShow = this.ControllerTable.Clone();
                for (int i = 0; i < ControllerTableShow.Columns.Count; i++)
                {
                    ControllerTableShow.Columns[i].DataType = typeof(string);
                }

                foreach (DataRow target_row in this.ControllerTable.Rows)
                {
                    ControllerTableShow.ImportRow(target_row);
                }

                for (int i = 1; i < ControllerTableShow.Columns.Count; i++)
                {
                    ControllerTableShow.Rows[0][i] = ControllerTableShow.Rows[0][i].ToString() + "%";
                    ControllerTableShow.Rows[1][i] = ControllerTableShow.Rows[1][i].ToString() + "%";
                }

                ControllerChartTable.Columns.Add("Month", typeof(string));
                ControllerChartTable.Columns.Add("Plan", typeof(double));
                ControllerChartTable.Columns.Add("Actual", typeof(double));
                ControllerChartTable.Columns.Add("StdTime", typeof(double));
                ControllerChartTable.Columns.Add("ActTime", typeof(double));
                ControllerChartTable.Columns.Add("DiffTime", typeof(double));

                for (int i = 1; i < ControllerTable.Columns.Count - 1; i++)
                {
                    DataRow controller_chart_row = ControllerChartTable.NewRow();
                    controller_chart_row["Month"] = ControllerTable.Columns[i].ColumnName;
                    controller_chart_row["Plan"] = Double.Parse(ControllerTable.Rows[0][i].ToString()) / 100;
                    controller_chart_row["Actual"] = Double.Parse(ControllerTable.Rows[1][i].ToString()) / 100;
                    controller_chart_row["StdTime"] = Double.Parse(ControllerTable.Rows[2][i].ToString());
                    controller_chart_row["ActTime"] = Double.Parse(ControllerTable.Rows[3][i].ToString());
                    controller_chart_row["DiffTime"] = Double.Parse(ControllerTable.Rows[4][i].ToString());
                    ControllerChartTable.Rows.Add(controller_chart_row);                    
                }
            }

            // Get data for FIN Report
            string sql_fin = "SELECT 'Plan' AS [Items],"
                + " " + this.plan + " AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [May-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [" + this.year + "]"
                + " UNION ALL"
                + " SELECT 'Actual' AS [Items],"
                + " 0 AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [May-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [" + this.year + "]"
                + " UNION ALL"
                + " SELECT 'Standard Time (TGC)' AS [Items],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 1 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 2 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 3 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 4 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 5 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [May-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 6 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 7 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 8 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 9 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 10 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 11 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 12 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(t1.[AssSTDTime] * t2.CommandQuantity)/60), 0, 0) AS [" + this.year + "]"
                + " FROM [222_Part] AS t1 INNER JOIN"
                + " [231_F5Plan] AS t2 ON t1.PartNo = t2.PartNo"
                + " WHERE (DATEPART(year, t2.FinishedDate) = " + this.year + ") AND (t1.F5 = 1) AND (t1.AssGroup = 'FIN')"
                + " UNION ALL"
                + " SELECT 'Actual Time (TGTT)' AS [Items],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 1 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 2 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 3 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 4 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 5 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [May-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 6 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 7 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 8 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 9 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 10 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 11 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 12 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " SUM(t1.[AssemblyTime])/60 AS [" + this.year + "]"
                + " FROM [231_TimeInput] AS t1 INNER JOIN"
                + " [231_F5Plan] AS t2 ON t1.TimePlanNo = t2.OrderNo INNER JOIN"
                + " [222_Part] AS t3 ON t2.PartNo = t3.PartNo"
                + " WHERE (DATEPART(year, t2.FinishedDate) = " + this.year + ") AND (t1.F5 = 1) AND (t3.F5 = 1) AND (t3.AssGroup = 'FIN')"
                + " UNION ALL"
                + " SELECT 'Different time' AS [Items],"
                + " 0 AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [May-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [" + this.year + "]";

            FINDataSet = mySQLManagement.SQL_Query(sql_fin);
            if (FINDataSet != null)
            {
                FINTable = FINDataSet.Tables[0];

                for (int i = 1; i < this.FINTable.Columns.Count; i++)
                {
                    double std = Double.Parse(this.FINTable.Rows[2][i].ToString());
                    double act = Double.Parse(this.FINTable.Rows[3][i].ToString());

                    this.FINTable.Rows[4][i] = std - act;

                    if (std != 0)
                    {
                        this.FINTable.Rows[1][i] = Math.Round(((std - act) / std) * 100, 2);
                    }
                }

                this.FINTableShow = this.FINTable.Clone();
                for (int i = 0; i < FINTableShow.Columns.Count; i++)
                {
                    FINTableShow.Columns[i].DataType = typeof(string);
                }

                foreach (DataRow target_row in this.FINTable.Rows)
                {
                    FINTableShow.ImportRow(target_row);
                }

                for (int i = 1; i < FINTableShow.Columns.Count; i++)
                {
                    FINTableShow.Rows[0][i] = FINTableShow.Rows[0][i].ToString() + "%";
                    FINTableShow.Rows[1][i] = FINTableShow.Rows[1][i].ToString() + "%";
                }

                FINChartTable.Columns.Add("Month", typeof(string));
                FINChartTable.Columns.Add("Plan", typeof(double));
                FINChartTable.Columns.Add("Actual", typeof(double));
                FINChartTable.Columns.Add("StdTime", typeof(double));
                FINChartTable.Columns.Add("ActTime", typeof(double));
                FINChartTable.Columns.Add("DiffTime", typeof(double));

                for (int i = 1; i < FINTable.Columns.Count - 1; i++)
                {
                    DataRow fin_chart_row = FINChartTable.NewRow();
                    fin_chart_row["Month"] = FINTable.Columns[i].ColumnName;
                    fin_chart_row["Plan"] = Double.Parse(FINTable.Rows[0][i].ToString()) / 100;
                    fin_chart_row["Actual"] = Double.Parse(FINTable.Rows[1][i].ToString()) / 100;
                    fin_chart_row["StdTime"] = Double.Parse(FINTable.Rows[2][i].ToString());
                    fin_chart_row["ActTime"] = Double.Parse(FINTable.Rows[3][i].ToString());
                    fin_chart_row["DiffTime"] = Double.Parse(FINTable.Rows[4][i].ToString());
                    FINChartTable.Rows.Add(fin_chart_row);
                }
            }

            // Get data for Mouter Report
            string sql_mouter = "SELECT 'Plan' AS [Items],"
                + " " + this.plan + " AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [May-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [" + this.year + "]"
                + " UNION ALL"
                + " SELECT 'Actual' AS [Items],"
                + " 0 AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [May-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [" + this.year + "]"
                + " UNION ALL"
                + " SELECT 'Standard Time (TGC)' AS [Items],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 1 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 2 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 3 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 4 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 5 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [May-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 6 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 7 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 8 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 9 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 10 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 11 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 12 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(t1.[AssSTDTime] * t2.CommandQuantity)/60), 0, 0) AS [" + this.year + "]"
                + " FROM [222_Part] AS t1 INNER JOIN"
                + " [231_F5Plan] AS t2 ON t1.PartNo = t2.PartNo"
                + " WHERE (DATEPART(year, t2.FinishedDate) = " + this.year + ") AND (t1.F5 = 1) AND (t1.AssGroup = 'M')"
                + " UNION ALL"
                + " SELECT 'Actual Time (TGTT)' AS [Items],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 1 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 2 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 3 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 4 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 5 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [May-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 6 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 7 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 8 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 9 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 10 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 11 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 12 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " SUM(t1.[AssemblyTime])/60 AS [" + this.year + "]"
                + " FROM [231_TimeInput] AS t1 INNER JOIN"
                + " [231_F5Plan] AS t2 ON t1.TimePlanNo = t2.OrderNo INNER JOIN"
                + " [222_Part] AS t3 ON t2.PartNo = t3.PartNo"
                + " WHERE (DATEPART(year, t2.FinishedDate) = " + this.year + ")"
                + " AND (t1.F5 = 1) AND (t3.F5 = 1) AND (t3.AssGroup = 'M')"
                + " UNION ALL"
                + " SELECT 'Different time' AS [Items],"
                + " 0 AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [May-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [" + this.year + "]";

            MouterDataSet = mySQLManagement.SQL_Query(sql_mouter);
            if (MouterDataSet != null)
            {
                MouterTable = MouterDataSet.Tables[0];

                for (int i = 1; i < this.MouterTable.Columns.Count; i++)
                {
                    double std = Double.Parse(this.MouterTable.Rows[2][i].ToString());
                    double act = Double.Parse(this.MouterTable.Rows[3][i].ToString());

                    this.MouterTable.Rows[4][i] = std - act;

                    if (std != 0)
                    {
                        this.MouterTable.Rows[1][i] = Math.Round(((std - act) / std) * 100, 2);
                    }
                }

                this.MouterTableShow = this.MouterTable.Clone();
                for (int i = 0; i < MouterTableShow.Columns.Count; i++)
                {
                    MouterTableShow.Columns[i].DataType = typeof(string);
                }

                foreach (DataRow target_row in this.MouterTable.Rows)
                {
                    MouterTableShow.ImportRow(target_row);
                }

                for (int i = 1; i < MouterTableShow.Columns.Count; i++)
                {
                    MouterTableShow.Rows[0][i] = MouterTableShow.Rows[0][i].ToString() + "%";
                    MouterTableShow.Rows[1][i] = MouterTableShow.Rows[1][i].ToString() + "%";
                }

                MouterChartTable.Columns.Add("Month", typeof(string));
                MouterChartTable.Columns.Add("Plan", typeof(double));
                MouterChartTable.Columns.Add("Actual", typeof(double));
                MouterChartTable.Columns.Add("StdTime", typeof(double));
                MouterChartTable.Columns.Add("ActTime", typeof(double));
                MouterChartTable.Columns.Add("DiffTime", typeof(double));

                for (int i = 1; i < MouterTable.Columns.Count - 1; i++)
                {
                    DataRow mouter_chart_row = MouterChartTable.NewRow();
                    mouter_chart_row["Month"] = MouterTable.Columns[i].ColumnName;
                    mouter_chart_row["Plan"] = Double.Parse(MouterTable.Rows[0][i].ToString()) / 100;
                    mouter_chart_row["Actual"] = Double.Parse(MouterTable.Rows[1][i].ToString()) / 100;
                    mouter_chart_row["StdTime"] = Double.Parse(MouterTable.Rows[2][i].ToString());
                    mouter_chart_row["ActTime"] = Double.Parse(MouterTable.Rows[3][i].ToString());
                    mouter_chart_row["DiffTime"] = Double.Parse(MouterTable.Rows[4][i].ToString());
                    MouterChartTable.Rows.Add(mouter_chart_row);
                }
            }

            // Get data for Ass Report
            string sql_ass = "SELECT 'Plan' AS [Items],"
                + " " + this.plan + " AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [May-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " " + this.plan + " AS [" + this.year + "]"
                + " UNION ALL"
                + " SELECT 'Actual' AS [Items],"
                + " 0 AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [May-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [" + this.year + "]"
                + " UNION ALL"
                + " SELECT 'Standard Time (TGC)' AS [Items],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 1 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 2 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 3 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 4 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 5 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [May-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 6 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 7 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 8 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 9 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 10 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 11 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 12 THEN t1.[AssSTDTime] * t2.CommandQuantity ELSE 0 END)/60), 0, 0) AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " ROUND((SUM(t1.[AssSTDTime] * t2.CommandQuantity)/60), 0, 0) AS [" + this.year + "]"
                + " FROM [222_Part] AS t1 INNER JOIN"
                + " [231_F5Plan] AS t2 ON t1.PartNo = t2.PartNo"
                + " WHERE (DATEPART(year, t2.FinishedDate) = " + this.year + ") AND (t1.F5 = 1) AND (t1.AssGroup = 'AS')"
                + " UNION ALL"
                + " SELECT 'Actual Time (TGTT)' AS [Items],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 1 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 2 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 3 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 4 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 5 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [May-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 6 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 7 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 8 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 9 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 10 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 11 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " SUM(CASE WHEN DATEPART(month, t2.FinishedDate) = 12 THEN t1.[AssemblyTime] ELSE 0 END)/60 AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " SUM(t1.[AssemblyTime])/60 AS [" + this.year + "]"
                + " FROM [231_TimeInput] AS t1 INNER JOIN"
                + " [231_F5Plan] AS t2 ON t1.TimePlanNo = t2.OrderNo INNER JOIN"
                + " [222_Part] AS t3 ON t2.PartNo = t3.PartNo"
                + " WHERE (DATEPART(year, t2.FinishedDate) = " + this.year + ")"
                + " AND (t1.F5 = 1) AND (t3.F5 = 1) AND (t3.AssGroup = 'AS')"
                + " UNION ALL"
                + " SELECT 'Different time' AS [Items],"
                + " 0 AS [Jan-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Feb-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Mar-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Apr-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [May-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Jun-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Jul-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Aug-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Sep-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Oct-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Nov-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [Dec-" + this.year.Substring(2, 2) + "],"
                + " 0 AS [" + this.year + "]";

            AssDataSet = mySQLManagement.SQL_Query(sql_ass);
            if (AssDataSet != null)
            {
                AssTable = AssDataSet.Tables[0];

                for (int i = 1; i < this.AssTable.Columns.Count; i++)
                {
                    double std = Double.Parse(this.AssTable.Rows[2][i].ToString());
                    double act = Double.Parse(this.AssTable.Rows[3][i].ToString());

                    this.AssTable.Rows[4][i] = std - act;

                    if (std != 0)
                    {
                        this.AssTable.Rows[1][i] = Math.Round(((std - act) / std) * 100, 2);
                    }
                }

                this.AssTableShow = this.AssTable.Clone();
                for (int i = 0; i < AssTableShow.Columns.Count; i++)
                {
                    AssTableShow.Columns[i].DataType = typeof(string);
                }

                foreach (DataRow target_row in this.AssTable.Rows)
                {
                    AssTableShow.ImportRow(target_row);
                }

                for (int i = 1; i < AssTableShow.Columns.Count; i++)
                {
                    AssTableShow.Rows[0][i] = AssTableShow.Rows[0][i].ToString() + "%";
                    AssTableShow.Rows[1][i] = AssTableShow.Rows[1][i].ToString() + "%";
                }

                AssChartTable.Columns.Add("Month", typeof(string));
                AssChartTable.Columns.Add("Plan", typeof(double));
                AssChartTable.Columns.Add("Actual", typeof(double));
                AssChartTable.Columns.Add("StdTime", typeof(double));
                AssChartTable.Columns.Add("ActTime", typeof(double));
                AssChartTable.Columns.Add("DiffTime", typeof(double));

                for (int i = 1; i < AssTable.Columns.Count - 1; i++)
                {
                    DataRow ass_chart_row = AssChartTable.NewRow();
                    ass_chart_row["Month"] = AssTable.Columns[i].ColumnName;
                    ass_chart_row["Plan"] = Double.Parse(AssTable.Rows[0][i].ToString()) / 100;
                    ass_chart_row["Actual"] = Double.Parse(AssTable.Rows[1][i].ToString()) / 100;
                    ass_chart_row["StdTime"] = Double.Parse(AssTable.Rows[2][i].ToString());
                    ass_chart_row["ActTime"] = Double.Parse(AssTable.Rows[3][i].ToString());
                    ass_chart_row["DiffTime"] = Double.Parse(AssTable.Rows[4][i].ToString());
                    AssChartTable.Rows.Add(ass_chart_row);
                }
            }

            BindData();
        }
    }
}
